import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';

@Component({
  selector: 'app-user-main',
  templateUrl: './user-main.component.html',
  styleUrls: ['./user-main.component.css']
})
export class UserMainComponent implements OnInit {

  public readerId: string = localStorage.getItem('ReaderId');

  public userPic: string = '../../../../assets/img/user.png';

  constructor(private router: Router) { }

  ngOnInit() {
    if (localStorage.getItem('ReaderId')) {
      this.userPic = '../../../../assets/img/caphandle.png';
    }
  }

  public goLogin_onclick(): void {
    if (!this.readerId) {
      this.router.navigate(['./login']);
    }
  }

  public goBookcase_onclick(): void {
    this.router.navigate(['./bookcase']);
  }

  public goMyBookcase_onclick(): void {
    this.router.navigate(['./bookcaselist']);
  }

  public goSettings_onclick(): void {
    this.router.navigate(['./settings']);
  }

}
